package com.xiaoshuidi.cloud.module.rooms.controller.admin.roomapartmentarea;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.security.core.util.SecurityFrameworkUtils;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.roomapartmentarea.vo.FuzzyQueryByAreaBuildingUnitVO;
import com.xiaoshuidi.cloud.module.rooms.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.rooms.service.IRoomApartmentAreaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 公寓下的小区 前端控制器
 * </p>
 *
 * @author hans.zhang
 * @since 2023-05-11
 */
@Tag(name = "管理后台 - 小区楼栋")
@RestController
@RequiredArgsConstructor
@RequestMapping(ApiConstants.NAME + "/roomapartmentarea")
public class RoomApartmentAreaController {

    private final IRoomApartmentAreaService roomApartmentAreaService;

    /**
     * 根据小区楼栋单元名模糊查询楼栋单元信息
     */
    @Operation(summary = "根据小区楼栋单元名模糊查询楼栋单元信息")
    @Parameters({
            @Parameter(name = "searchBox", description = "搜索框内容"),
            @Parameter(name = "apartmentId", description = "门店id"),
    })
    @GetMapping("fuzzy-query-by-area-building-unit")
    public CommonResult<List<FuzzyQueryByAreaBuildingUnitVO>> fuzzyQueryByAreaBuildingUnit(String searchBox, Long apartmentId){
        return CommonResult.success(roomApartmentAreaService.fuzzyQueryByAreaBuildingUnit(searchBox,apartmentId));
    }
}
